#ifndef PGSQL_H
#define PGSQL_H

#include "tracksql.h"

#define PGPOKER_GAMEID_SIZE		16
typedef char PGPokerGameID[PGPOKER_GAMEID_SIZE];

class PGPokerOpts;
class PGPokerSavedGame;

//
// All money values are in cents (100 == $1, 25 == $.25, 1 == $.01)
//
// IMPORTANT:  Access to this class is NOT thread-safe.  That's handled at
//			   the next level up (with calls to lock()/unlock()).
//

class PGPokerSQL : public TrackSQL
{
	public:
		PGPokerSQL(const String& DBDSN, const String& DBLogin, const String& DBPassword);

		int32 getOptions(PGPokerOpts*);

		int32 createGame(int32 casinoId, PID, bool8 forMoney, uint8 machid,
			int32 numCards, SESSIONID, int32 compFactor,
			PGPokerGameID, int32 bet,
			int32* balance, int32* comp);

        int32 deal(PID pid, PGPokerGameID gid, int32 numPlayer, uint8* player);     // kharmon.  11-07-06.  #8226.  

		int32 gameDone(int32 casinoId, PID, bool8 forMoney, uint8 machid, 
			PGPokerGameID,
			int32 payout, int32 commission,
			int32* dealerTwoCard, int32* playerTwoCard,
			int32 dealerFiveCardJokerAsRank, int32 playerFiveCardJokerAsRank,
			int32 hiOutcome, int32 loOutcome, int32 gameOutcome,
			int32 balanceAdjust, int32* balance, int32* comp,
            int32 numDealer, uint8* dealer,         // kharmon.  10-16-06.  #8226.
			int32 numPlayer, uint8* player);

		int32 hasSavedGame(PID, bool8 forMoney, uint8 machid, PGPokerGameID,
			PGPokerSavedGame*, bool8* exists);
		int32 removeSavedGame(PID, bool8 forMoney, uint8 machid);

		int32 saveGame(PID, bool8 forMoney, uint8 machid, PGPokerGameID, PGPokerSavedGame*);

	protected:
		void jokerAsRankToDB(int32, char*);
};

#endif
